<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>8.3.JS函数-函数的参数-练习1</title>
    <script>
        // 1.利用函数求任意两个数的和
        function getSum(num1, num2) {
            console.log(num1 + num2);
        }
        getSum(1, 2);
        getSum(3, 8);
        getSum(20, 31);
        console.log('------------------------------------');
        // 2.利用函数求任意两个数之间的和
        function getSums(start, end) {
            var sum = 0;
            for (var j = start + 1; j < end; j++) {
                sum += j;
            }
            console.log(sum);
        }
        getSums(3, 6);
        getSums(1, 10);
        //3.注意点
        //（1）多个参数之间用逗号隔开
        //（2）形参可以看做不用声明的变量
    </script>
</head>

<body>

</body>

</html>